package e

import (
	"net/http"
	"strconv"
)

const (
	// 系统内部错误 4440-4450开始
	StructBindingFailed                = 4440 // 结构体绑定失败
	TokenResolutionFailed              = 4441 // token解析失败
	TheTokenHasExpired                 = 4442 // token已过期
	CreateTokenERROR                   = 4443 // 创建token失败
	SuspectedTokenDoesNotExist         = 4444 // 疑似token不存在
	TheTopUpAmountIsInvalid            = 4445 // 充值金额无效
	ThePaymentKeyWasEnteredIncorrectly = 4446 // 支付密码输入错误
	TokenInBlackList                   = 4447 // token已在黑名单中

	// 用户模块 1000--1100
	TheUserFailedToLogIn        = 1000 // 用户登录失败
	InsufficientUserPermissions = 1001 // 用户权限不足
	ThePasswordIsIncorrect      = 1002 // 密码错误
	TheUserExists               = 1003 // 用户已存在
	TheUserNotExists            = 1004 // 用户不存在

	// 宠物模块 2000开始
	PetQueryFailed  = 2001 // 宠物查询失败
	PetAddFailed    = 2002 // 宠物添加失败
	ThePetNotExists = 2003 // 宠物不存在

	// 商品模块 3000开始

	// 订单模块 4000开始

	// 寄养模块 5000开始
	ThePetHasAlreadyBeenFostered        = 5001 // 该宠物已寄养
	DeletingFosterCareInformationFailed = 5002 // 删除寄养信息失败
	TheAppointmentRecordDoesNotExist    = 5003 // 预约记录不存在

	// 领养模块 6000开始

	// 服务模块 7000开始

	// 系统模块 8000开始

	// 权限模块 9000开始
)

var Msginfo = map[int]string{
	200:                                 "操作成功",
	TheUserFailedToLogIn:                "用户登录失败",
	InsufficientUserPermissions:         "用户权限不足",
	TheUserExists:                       "用户已存在",
	TokenResolutionFailed:               "token解析失败",
	TheTokenHasExpired:                  "token已过期",
	ThePasswordIsIncorrect:              "密码错误",
	CreateTokenERROR:                    "创建token失败",
	TheUserNotExists:                    "用户不存在",
	SuspectedTokenDoesNotExist:          "疑似token不存在",
	TheTopUpAmountIsInvalid:             "充值金额无效",
	ThePaymentKeyWasEnteredIncorrectly:  "支付密码输入错误",
	TokenInBlackList:                    "token已在黑名单中",
	PetQueryFailed:                      "宠物查询失败",
	PetAddFailed:                        "宠物添加失败",
	ThePetNotExists:                     "宠物不存在",
	ThePetHasAlreadyBeenFostered:        "该宠物已寄养",
	StructBindingFailed:                 "结构体绑定失败",
	DeletingFosterCareInformationFailed: "删除寄养信息失败",
	TheAppointmentRecordDoesNotExist:    "预约记录不存在",
}

func GetMsgInfo(code int) string {
	Msginfo, ok := Msginfo[code]
	if ok {
		return Msginfo
	} else {
		return strconv.Itoa(http.StatusBadRequest) + " fail"
	}
}
